package net;

import java.awt.Point;
import java.io.Serializable;
import java.util.Vector;

import main.GameDef;
import visual.FrameHandler;

public class Message implements Serializable, GameDef{
	private static final long serialVersionUID = -9106478715964172372L;
	public int eventType;
	public int pieceType;
	public Point castlePos;
	public Point attackPos;
	public visual.Piece piece;
	public boolean canPutCastle;
	public boolean canPutPiece;
	public boolean canBuyPiece;
	public boolean canAttack;
	public boolean isPlayerTurn;
	public String message;
	public Vector attributes;
	public boolean serverMsg;
	
	
	public Message(){
		
	}
	
	public Message(String _message, Vector _attributes, boolean isServerMsg){
		attributes = _attributes;
		message = _message;
		serverMsg = isServerMsg;
		if(message.equals(DIALOG_BUY_STRINGS[DIALOG_BUY_PAY]) || message.equals("piece paid")){
			pieceType = FrameHandler.piecesNames.indexOf(attributes.get(0));
		} else if(message.equals("piece position")){
			piece = (visual.Piece)attributes.get(0);
		} else if(message.equals("piece created")){
			piece = (visual.Piece)attributes.get(0);
		}else if(message.equals("attack position")){
			attackPos = (Point)attributes.get(0);
		}
	}
	
}
